//
//  YDEmoticonModels.swift
//  weibo
//
//  Created by 孙亚东 on 16/7/3.
//  Copyright © 2016年 Sunyadong. All rights reserved.
//

import UIKit

class YDEmoticonModels: NSObject {
    
    
    var code: String?{
    
        didSet {
        
            guard let code = code else {
            
                return
            
            }
        
            // 创建一个NSScanner
            let scanner = NSScanner(string: code)
            // 定义一个UInt32类型的变量,用于接收扫描返回的数据
            var result: UInt32 = 0
            scanner.scanHexInt(&result)
            // 把result 转换成Unicode
            let unicode = UnicodeScalar(result)
            // 把unicdoe转换成Character
            let character = Character(unicode)

            emoji = "\(character)"
            
            
        }
    
  
    }
    
    
    var chs: String?
    
    
    var png: String?
    
    
    var path: String?
    
    
    var emoji: String?
    
    
    init(dic: [String: String]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dic)
        
        
    }
    
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
        
        
        
    }
    
    

}
